package com.example.hospitalsystem.config;

import com.example.hospitalsystem.handle.SessionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private SessionInterceptor sessionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(sessionInterceptor) //拦截器注册表中添加拦截器
                .addPathPatterns("/**") //指定拦截路径
                .excludePathPatterns(
                        "/doc.html/**",
                        "/v3/api-docs/**",
                        "/webjars/**",
                        "/auth/**",
                        "/user/**",
                        "/email/**",
                        "/design/**",
                        "/notice/**",
                        "/doctor/getAlllDoctorInfo",
                        "/doctor/doctorInfo/**"
                        );
    }
}
